package com.sunbim.rsrv.common.response;


import com.sunbim.rsrv.common.exception.Error;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class R {
    private int status;
    private String msg;
    private Object data;


    public static R success(Object data) {

        R r = new R(200, "success", data);
        return new R(200, "success", data);
    }

    public static R error(Error error) {
        return new R(error.getStatus(), error.getMsg(), null);
    }

    public static R error(Error error, String msg) {
        return new R(error.getStatus(), msg, null);
    }

    public static R error(int status, String msg) {
        return new R(status, msg, null);
    }
}
